<template>
	<view class="content">
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view>
			<view>{{ number + 1 }}</view>
			<view>{{ ok ? 'YES' : 'NO' }}</view>
			<view>{{ message.split('').reverse().join('') }}</view>
		</view>
		<view v-if="!raining">今天天气真好</view>
		<view v-if="raining">下雨天，只能在家呆着了</view>
		<view v-if="state ==='vue'">state的值是 Vue</view>
		<view>State is {{state?'vue':'APP'}}</view>
		<view>
			<view v-if="state ==='vue'">uni-app</view>
			<view v-else-if ="state==='html'"> HTML</view>
			<view v-else> APP</view>
		</view>
		
		<view v-for="item in arr" style="color:#ff0000;">
			{{item}}
		</view>
		<view v-for="(item,index) in 6" style="color: #00ff00;">
			<view :class="'list-'+ index%2">{{index+1}}</view>
		</view>
		<view v-for="(value, name, index) in object">
			{{ index }}.{{ name }}:{{ value }}
		</view>
		<view v-for="item in arr" :key="item.id">
			<view style="color:#0000ff;">{{item.id}}:{{item.name}}</view>
		</view>
		<view :class="'chagecolor'+index" @click="changeColor"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				number: 1,
				ok: true,
				message: 'Hello Vue!',
				raining : false,
				state :'vue',
				arr:[{id:1,name:'uni-app'},{id:2,name:'HTML'}],
				index:0,
				object:{
					title:'How to do lists in Vue',
					author:'Jane Doe',
					publishedAt:'2020-04-10',
				}
			}
		},
		onLoad() {
			if(5=="5"){
				console.log("onLoad---> 5相等");
			}else{
				console.log("onLoad--->5不相等");
			}
			if(6==="6"){
				console.log("onLoad---> 6相等");
			}else{
				console.log("onLoad--->6不相等");
			}
		},
		methods: {
			changeColor(){
				this.index++;
				this.index =this.index%3;
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	.list-1{
		color: aqua;
	}
	.list-0{
		color: brown;
	}
	.chagecolor0{
		width: 200rpx;
		height: 200rpx;
		background-color: red;
	}
	.chagecolor1{
		width: 300rpx;
		height: 300rpx;
		background-color: green;
	}
	.chagecolor2{
		width: 100rpx;
		height: 100rpx;
		background-color: blue;
	}
</style>